Leaky ReLU
Leaky Rectified Linear Unit
$ f(x) = \begin{cases} x, & \text{if } x \geq 0 \\ \alpha x, & \text{if } x < 0 \end{cases}
αは小さな正の定数で、通常は0.01に設定される
Leaky ReLU と ReLU の違い
普通のReLUは負の入力はすべて0になる
Leaky ReLUは負の値に対して小さな値を漏らす
これにより死んだニューロンの問題を軽減する
実装例
code:PyTorch.py
import torch.nn as nn
leaky_relu = nn.LeakyReLU(negative_slope=0.01)
code:TensorFlow/Keras.py
from tensorflow.keras.layers import LeakyReLU
leaky_relu = LeakyReLU(alpha=0.01)
生成的敵対ネットワーク(GAN)で勾配消失問題を避けるために使用
変分オートエンコーダ(VAE)で使用